package com.vipheyue.bigcompany.utils;

import android.content.Context;
import android.content.SharedPreferences;

/**
 * Created by heyue on 2015/10/31.
 */
public class DataUtil {
    private static  DataUtil dataUtil=null;
    private DataUtil(){}
    public static  DataUtil getInstance() {//单例设计式-饱汉式
        if (dataUtil == null) {
            synchronized (DataUtil.class) {
                if (dataUtil == null) {
                    dataUtil=new DataUtil();
                }
            }
        }
    return dataUtil;
    }

    public static SharedPreferences getSP(Context context) {
        SharedPreferences  sp = context.getSharedPreferences("swustConfig", Context.MODE_PRIVATE);
        return sp;
    }
    public  static void putSpBoolean(String info ,Boolean flag,Context context) {
        SharedPreferences  sp=  getSP(context);
        SharedPreferences.Editor editor = sp.edit();
        editor.putBoolean(info, flag);
        editor.commit();
    }
}
